import { PageReq, PageRes } from '@/api/types'
import request from '@/utils/request'
import { TaskModel } from '@/api/model/task-model'

// 获取审核列表
export function taskPageApi(data: PageReq<Partial<any>>) {
  return request<PageRes<TaskModel>>({
    url: '/task/page',
    method: 'post',
    data
  })
}

// 新增审核
export function addTaskApi(data: Partial<TaskModel>) {
  return request({
    url: '/task/add',
    method: 'post',
    data
  })
}

// 更新审核
export function editTaskApi(data: Partial<TaskModel & { id: number }>) {
  return request({
    url: '/task/edit',
    method: 'post',
    data
  })
}

// 删除审核
export function delTaskApi(data: { id: number }) {
  return request({
    url: '/task/del',
    method: 'post',
    data
  })
}

// 审核
export function approveTaskApi(data: any) {
  return request({
    url: '/task/approve',
    method: 'post',
    data
  })
}

// 审核详情
export function getDetailApi(data: any) {
  return request({
    url: '/task/detail',
    method: 'post',
    data
  })
}

// 获取可领用资产列表
export function getReceiveAssetListApi(data: {
  isUserId: boolean
  orgId: number
  typeId: number | undefined
}) {
  return request({
    url: '/task/getReceiveAssetList',
    method: 'post',
    data
  })
}
